# Rather generic Makefile for simple projects using htc and testing with
# fmsx. MSX-DOS targeted, since we're making a DOS disk image.

# Compiler

CC=htc

# Compile options

OPTIONS=-O -v

# WHat do we want to make

TARGET=kink

# libraries to link

LIBS=-lg -lf

# Extra objects file for linking

EXTRAS=loadgrp.o gprint2.o

# Other files to put on the disk image

OTHERFILES=kink.gfx

# Where can we find MSXDOS.SYS and COMMAND.COM

DOSFILEPATH=.

#######################################################################

all: emutest

emutest: $(TARGET) dsk
	fmsx -diska $(TARGET).dsk

dsk: $(TARGET)
	rm -f $(TARGET).dsk autoexec.bat
	echo $(TARGET) > autoexec.bat
	wrdsk $(TARGET).dsk $(DOSFILEPATH)/msxdos.sys $(DOSFILEPATH)/command.com $(TARGET).com autoexec.bat $(OTHERFILES)

$(TARGET): $(TARGET).c 
	$(CC) $(OPTIONS) -o $(TARGET).com $(TARGET).c $(LIBS) $(EXTRAS) 	

clean:
	rm $(TARGET).com 
